Skip to content

test(desktop): story-cover the renderer crash fallback - #3947

Open
liuxiaocs7 wants to merge 2 commits into
apache:mainfrom
liuxiaocs7:liuxiaocs7/test-desktop-the-crash-fallback-has-no-story
Open

test(desktop): story-cover the renderer crash fallback#3947
liuxiaocs7 wants to merge 2 commits into
apache:mainfrom
liuxiaocs7:liuxiaocs7/test-desktop-the-crash-fallback-has-no-story

Conversation

@liuxiaocs7

@liuxiaocs7 liuxiaocs7 commented Aug 26, 2026

Copy link
Copy Markdown
Member

Summary

The top-level renderer ErrorBoundary (apps/desktop/src/renderer/error-boundary.tsx) had no Storybook coverage — it is the surface hardest to reach in normal use and the one whose correctness matters most when reached, so its four copyState values and the repeat-error path could only be seen by actually crashing the app.

This PR extracts the fallback face into a pure presentational ErrorBoundaryFallback component (the class still owns all state and side effects, so behavior is unchanged), then adds one story per state — default fallback, copy pending, copied, copy failed, repeat error — each with a // Real path: annotation per stories/FIDELITY.md. Rendering the fallback directly rather than triggering a real throw keeps the render smoke free of the console.error that componentDidCatch would otherwise emit.

Fixes #3943

Verification

Ran locally, all passing:

  • biome lint — clean
  • tsc (tsconfig.storybook.json + tsconfig.renderer.json)
  • npm run build-storybook — all five product-shell-error-boundary--* in the index
  • npm run smoke:storybookStorybook render smoke passed (200 stories)., all five new stories render clean

The five states are visible in Storybook under Product/Shell/Error Boundary; the render smoke above is the command-output evidence that each mounts without runtime, console, or AX errors.

error-boundary--default-fallback error-boundary--repeat-error

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Code assisted with the ErrorBoundaryFallback extraction and the story authoring; the design decisions and verification are my own. The affected commit carries a Generated-by: Claude Code trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@liuxiaocs7 liuxiaocs7 changed the title test(desktop): story-cover the renderer crash fallback (#3943) test(desktop): story-cover the renderer crash fallback Aug 26, 2026
The top-level renderer ErrorBoundary is the surface hardest to reach in
normal use and the one whose correctness matters most when reached: a
crash the user cannot read or copy is a crash we never hear about. It had
no Storybook coverage, so its four copyState values and repeat-error path
could only be seen by actually crashing the app (and the failed-copy
state only by additionally failing the clipboard bridge).

Extract the fallback face into a pure presentational ErrorBoundaryFallback
component (the class still owns all state and side effects) so each state
renders directly, then add one story per state — default fallback, copy
pending, copied, copy failed, and repeat error — following the FIDELITY
conventions in apps/desktop/stories. Rendering the fallback directly (no
real throw) keeps the render smoke free of the console.error that
componentDidCatch would otherwise emit.

Ran biome lint, tsc (stories and renderer), build-storybook, and the
storybook render smoke (200 stories, all five error-boundary stories).

Generated-by: Claude Code
@liuxiaocs7
liuxiaocs7 force-pushed the liuxiaocs7/test-desktop-the-crash-fallback-has-no-story branch from 82fc14b to 3e1ba88 Compare August 26, 2026 17:39
@github-actions github-actions Bot added the effort/M Under 500 readable lines label Aug 27, 2026

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding visual coverage for the renderer crash fallback. Extracting and rendering the production ErrorBoundaryFallback is the right seam, and the idle, pending, copied, and failed visual states can provide useful regression coverage.

I am not approving the current scope yet, because two parts add claims without demonstrating the corresponding behavior. RepeatError is another static idle-state rendering rather than a reset-and-rethrow test, and the diagnostic fixtures describe a “Real path” using Maka components and files that do not exist.

I left both points inline. The smallest coherent version of this PR would keep the four real visual states, remove RepeatError unless it becomes a genuine interaction test, and label the stack data as synthetic rather than inventing a product call chain. That would retain the useful coverage while removing the low-value representations.

Reviewed with Codex and an independent @Reviewer agent. I verified the exact head, production fallback ownership, Story states, referenced renderer paths, and passing Storybook smoke coverage.

中文对照

谢谢你为 renderer 崩溃 fallback 增加视觉覆盖。提取并直接渲染生产中的 ErrorBoundaryFallback 是正确的接缝;idle、pending、copied 和 failed 四种视觉状态也能提供有价值的回归覆盖。

目前我还不准备 Approve,因为其中两部分只增加了描述,却没有证明相应行为。RepeatError 只是另一个静态 idle 状态,并没有测试 reset 后再次抛错;诊断 fixture 所谓的 “Real path” 又使用了仓库中不存在的 Maka 组件和文件。

我已经把两点留在行内。最小且连贯的版本应该保留四个真实视觉状态;除非 RepeatError 改成真正的交互测试,否则可以删除;stack 数据也应明确标为 synthetic,而不是虚构产品调用链。这样既能保留有价值的覆盖,也能删除低价值表示。

本次审查使用了 Codex 和一个独立的 @Reviewer 子代理;我核对了精确 head、生产 fallback 的职责、Story 状态、引用的 renderer 路径和 Storybook smoke 结果。

Comment thread apps/desktop/stories/error-boundary.stories.tsx Outdated
Comment thread apps/desktop/stories/error-boundary.stories.tsx Outdated
@liuxiaocs7

Copy link
Copy Markdown
Member Author

Thanks for the careful review, @Astro-Han. Addressed both [P2] points in 472ebae:

  1. Synthetic fixtures — removed the invented Maka symbols and the // Real path: annotations; the stack/component-stack data is now explicitly labeled synthetic with neutral placeholders.
  2. RepeatError — removed it; the PR keeps only the four real visual states you called out as useful (idle / pending / copied / failed). A reset-and-rethrow interaction test belongs at the real ErrorBoundary and I'm glad to do it as a follow-up if wanted.

Re-ran locally: biome lint, tsc (stories + renderer), build-storybook, and the render smoke (199 stories, all four error-boundary states pass). Ready for another look when you have a moment.

@liuxiaocs7
liuxiaocs7 requested a review from Astro-Han August 29, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/M Under 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(desktop): the crash fallback has no story

2 participants